package cn.org.authority.dao;

import cn.org.authority.bean.Permission;
import cn.org.authority.comm.dao.CommMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName PermissionMapper
 * @Author swj
 * @Date 2020/9/9 20:34
 */
@Mapper
public interface PermissionMapper extends CommMapper<Permission> {

    @Select("select p.* from au_permission p ,au_role_permission rp where p.id = rp.pid and rp.rid = #{rid}")
    List<Permission> getPermissionsByRole(Integer rid);

    @Select("select name from au_permission_do pd where pd.pid = #{pid}")
    List<String> getDoByPermission(Integer pid);

}
